package tienich360.com.lib;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;

public class LinkStore {
	public void showExitDialog_tienich360(final Activity activity) {
		AlertDialog.Builder ab = new AlertDialog.Builder(activity);
		ab.setMessage("Bạn có chắc muốn thoát ứng dụng?");
		ab.setNeutralButton("Tải ứng dụng Free",
				new DialogInterface.OnClickListener() {

					public void onClick(DialogInterface dialog, int which) {
						try {
							Intent intent = new Intent(Intent.ACTION_VIEW);
							intent.setData(Uri
									.parse("market://search?q=pub:GameApp+Free"));
							activity.startActivity(intent);
						} catch (Exception e) {
							Intent intent = new Intent(Intent.ACTION_VIEW);
							intent.setData(Uri
									.parse("https://play.google.com/store/apps/developer?id=GameApp+Free"));
							activity.startActivity(intent);
						}
					}
				});
		ab.setPositiveButton("Thoát", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				activity.finish();
			}
		});
		ab.setNegativeButton("Trở lại", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		ab.show();
	}
	public void showExitDialog_giaitri25h(final Activity activity) {
		AlertDialog.Builder ab = new AlertDialog.Builder(activity);
		ab.setMessage("Bạn có chắc muốn thoát ứng dụng?");
		ab.setNeutralButton("Tải ứng dụng Free",
				new DialogInterface.OnClickListener() {

					public void onClick(DialogInterface dialog, int which) {
						try {
							Intent intent = new Intent(Intent.ACTION_VIEW);
							intent.setData(Uri
									.parse("market://search?q=pub:GiaiTri25h.com"));
							activity.startActivity(intent);
						} catch (Exception e) {
						}
					}
				});
		ab.setPositiveButton("Thoát", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				activity.finish();
			}
		});
		ab.setNegativeButton("Trở lại", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		ab.show();
	}
	public void showExitDialog_FPT_Bluesea(final Activity activity) {
		AlertDialog.Builder ab = new AlertDialog.Builder(activity);
		ab.setMessage("Bạn có chắc muốn thoát ứng dụng?");
		ab.setNeutralButton("Tải ứng dụng Free",
				new DialogInterface.OnClickListener() {

					public void onClick(DialogInterface dialog, int which) {
						try {
							Intent intent = new Intent(Intent.ACTION_VIEW);
							intent.setData(Uri
									.parse("http://fptstore.vn/searchResult.html?keywords=Bluesea+Media+JSC"));
							activity.startActivity(intent);
						} catch (Exception e) {
						}
					}
				});
		ab.setPositiveButton("Thoát", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				activity.finish();
			}
		});
		ab.setNegativeButton("Trở lại", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		ab.show();
	}
	public void LinkToStore_FPT_Bluesea(final Activity activity) {
		try {
			Intent intent = new Intent(Intent.ACTION_VIEW);
			intent.setData(Uri.parse("http://fptstore.vn/searchResult.html?keywords=Bluesea+Media+JSC"));
			activity.startActivity(intent);
		} catch (Exception e) {

		}
	}
	public void LinkToStore_tienich360(final Activity activity) {
		try {
			Intent intent = new Intent(Intent.ACTION_VIEW);
			intent.setData(Uri.parse("market://search?q=pub:tienich360.com"));
			activity.startActivity(intent);
		} catch (Exception e) {

		}
	}
	public void LinkToStore_giaitri25h(final Activity activity) {
		try {
			Intent intent = new Intent(Intent.ACTION_VIEW);
			intent.setData(Uri.parse("market://search?q=pub:GiaiTri25h.com"));
			activity.startActivity(intent);
		} catch (Exception e) {

		}
	}

	public void LinkToStore_ToApp(final Activity activity, String packagename) {
		try {
			Intent intent = new Intent(Intent.ACTION_VIEW);
			intent.setData(Uri.parse("market://details?id=" + packagename));
			activity.startActivity(intent);
		} catch (Exception e) {

		}
	}

	public void LinkToStore_bluesea(final Activity activity) {
		try {
			Intent intent = new Intent(Intent.ACTION_VIEW);
			intent.setData(Uri.parse("market://search?q=pub:Bluesea+Studio"));
			activity.startActivity(intent);
		} catch (Exception e) {

		}
	}

	public void showExitDialog_bluesea(final Activity activity) {
		AlertDialog.Builder ab = new AlertDialog.Builder(activity);
		ab.setMessage("Bạn có chắc muốn thoát ứng dụng?");
		ab.setNeutralButton("Tải ứng dụng Free",
				new DialogInterface.OnClickListener() {

					public void onClick(DialogInterface dialog, int which) {
						try {
							Intent intent = new Intent(Intent.ACTION_VIEW);
							intent.setData(Uri
									.parse("market://search?q=pub:Bluesea+Studio"));
							activity.startActivity(intent);
						} catch (Exception e) {
							Intent intent = new Intent(Intent.ACTION_VIEW);
							intent.setData(Uri
									.parse("https://play.google.com/store/apps/developer?id=Bluesea+Studio"));
							activity.startActivity(intent);
						}
					}
				});
		ab.setPositiveButton("Thoát", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				activity.finish();
			}
		});
		ab.setNegativeButton("Trở lại", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		ab.show();
	}

	public void showExitDialog_NO_GP(final Activity activity) {
		AlertDialog.Builder ab = new AlertDialog.Builder(activity);
		ab.setMessage("Bạn có chắc muốn thoát ứng dụng?");
		ab.setPositiveButton("Đồng ý", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				activity.finish();
			}
		});
		ab.setNegativeButton("Không", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		ab.show();
	}

	public void LinkToStore_thinh(final Activity activity) {
		try {
			Intent intent = new Intent(Intent.ACTION_VIEW);
			intent.setData(Uri.parse("market://search?q=pub:Vi-Like+App"));
			activity.startActivity(intent);
		} catch (Exception e) {

		}
	}

	public void showExitDialog_thinh(final Activity activity) {
		AlertDialog.Builder ab = new AlertDialog.Builder(activity);
		ab.setMessage("Bạn có chắc muốn thoát ứng dụng?");
		ab.setNeutralButton("Tải ứng dụng Free",
				new DialogInterface.OnClickListener() {

					public void onClick(DialogInterface dialog, int which) {
						try {
							Intent intent = new Intent(Intent.ACTION_VIEW);
							intent.setData(Uri
									.parse("market://search?q=pub:Vi-Like+App"));
							activity.startActivity(intent);
						} catch (Exception e) {
							Intent intent = new Intent(Intent.ACTION_VIEW);
							intent.setData(Uri
									.parse("https://play.google.com/store/apps/developer?id=Vi-Like+App"));
							activity.startActivity(intent);
						}
					}
				});
		ab.setPositiveButton("Thoát", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				activity.finish();
			}
		});
		ab.setNegativeButton("Trở lại", new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		ab.show();
	}
}